# encoding: utf-8
import glob
from sys import argv

sourceDir = 'minecraft-server'

list_files = glob.iglob(sourceDir + "/" + '*.java')

try:
    searchString = argv[1]
    print
    print "searching " + searchString

    for file_name in list_files:

        with open(file_name) as java_file:

            litsOfStrings = java_file.readlines()

            for stringIterator in litsOfStrings:
                if searchString in stringIterator:                    
                    print('>>> in file: ' + file_name)
                    break                    
except:
    print "Usage: python <program>.py <search string>"